﻿using System.Runtime.Serialization;
using CID.Domain.Infrastructure;

namespace CID.Execution.Support.Information
{
    [DataContract]
    public class PackageInfo
    {
        internal PackageInfo() { }

        public PackageInfo(IPackage package)
        {
            Id = package.Id;
            Type = new PackageTypeInfo(package.Type);
            Comment = package.Comment;
            Content = package.Content;
        }

        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public PackageTypeInfo Type { get; set; }

        [DataMember]
        public string Comment { get; set; }

        [DataMember]
        public byte[] Content { get; set; }

        internal PackageInfo Clone()
        {
            return new PackageInfo() { Id = Id, Comment = Comment, Content = (byte[])Content.Clone(), Type = Type.Clone() };
        }
    }
}
